﻿using BCCommon.TMS.Transport;
using BCDto.TMS.VehicleBusinessMapping;
using BCDto.TMS.VehicleType;
using BCService.TMS.VehicleTypeService;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BCTMSRESTful.Controllers.ClientApp.VehicleType
{
    /// <summary>
    /// 车型
    /// </summary> 
    [Route("api/v1/ClientApp/[controller]")]
    [ApiExplorerSettings(GroupName = "ClientApp")]
    public class VehicleTypeController : ClientAppBaseController
    {
        private readonly IVehicleTypeService vehicleTypeService;

        public VehicleTypeController(IVehicleTypeService vehicleTypeService)
        {
            this.vehicleTypeService = vehicleTypeService;
        }

        /// <summary>
        /// 获取区县车型
        /// </summary>
        /// <param name="countyCode">区县编码</param>
        /// <param name="transportBusinessType">运输业务类型</param>
        /// <returns></returns>
        [HttpGet]
        [ProducesResponseType(typeof(IEnumerable<VehicleBusinessMappingViewDto>), 200)]
        public IActionResult GetList([FromQuery(Name = "county_code")] string countyCode,
            [FromQuery(Name = "transport_business_type")] TransportBusinessType? transportBusinessType)
        {
            long? agentRecordId = GetAgentRecordIdByCountyCode(countyCode);
            var result = this.vehicleTypeService.GetList(agentRecordId, countyCode, transportBusinessType);
            return this.Ok(result);
        }
    }
}
